<div class="box-body">
    <form role="form" action="adddata" method="post">
        <input type="hidden" name="_token" value="{{csrf_token()}}">

        <div class="form-group">
            <label>用户身份</label>
            <select name="type" class="form-control type">
                <option value="1">零售户</option>
                <option value="2">消费者</option>
            </select>
        </div>
        <!-- text input -->
        <div class="form-group sellerno">
            <label>专卖证号</label>
            <input type="number" name="sellernum" class="form-control" placeholder="输入 ...">
        </div>
        <div class="form-group mobile">
            <label>手机号</label>
            <input type="number" name="mobile" class="form-control" placeholder="输入 ...">
        </div>
        <div class="form-group shop">
            <label>店铺名称</label>
            <input type="text"  name="shopname"  class="form-control" placeholder="输入 ..."  readonly>
        </div>
        <!-- checkbox -->
        <div class="form-group">
            <label>限制权限</label>
            <div class="checkbox">
                <label>
                    <input type="checkbox" value="1" name="fb">
                    发布帮团购
                </label>
            </div>

            <div class="checkbox">
                <label>
                    <input type="checkbox" value="2" name="cy">
                    参与帮团购
                </label>
            </div>

            <div class="checkbox">
                <label>
                    <input type="checkbox" value="3" name="bd">
                    绑定帮团购
                </label>
            </div>
        </div>
        <div class="form-group">
            <label>限制时间</label>
            <div class="radio">
                <label >
                    <input type="radio" class="no" name="optionsRadios" id="optionsRadios1" value="1" checked>
                    无时间限制
                </label>
            </div>
            <div class="radio">
                <label >
                    <input type="radio" class="yes" name="optionsRadios" id="optionsRadios2" value="2">
                    有时间限制
                </label>
            </div>
        </div>
        <div class="form-group day">
            <label></label>
            <input type="number" name="daynum" class="form-control" placeholder="输入 ...">天
        </div>

        <!-- textarea -->
        <div class="form-group">
            <label>限制原因</label>
            <textarea class="form-control" name="reason" rows="3" placeholder="输入 ..."></textarea>
        </div>
        <div class="form-group">
            <input type="submit" id="submit" name="submit_button" value="提交" />
        </div>
    </form>
    <script>
        var type;
        var day;
        $(function () {
            $('.type').change(function () {
                type = $('.type').val();
                if(type==1){
                    $('.mobile').hide();
                    $('.shop').show();
                    $('.sellerno').show();
                }else{
                    $('.mobile').show();
                    $('.shop').hide();
                    $('.sellerno').hide();
                }
            });
            $('.radio .no , .yes').click(function () {
                day = $("input[name=optionsRadios]:checked").val();
                if(day==1){
                    $('.day').hide();
                }else{
                    $('.day').show();
                }
            });
            $("input[name=sellernum]").blur(function(){
                var sellerno = $(this).val();
                console.log(sellerno);
                if(sellerno == ''){
                    return false;
                }
                $.post('getseller',{sellerno:sellerno,_token:'{{csrf_token()}}'},function (res) {
                    if(res){
                        $(".shop input").val(res);
                    }
                })
            });
            $('.type').change();
            $('.day').hide();
        })

    </script>
</div>